package com.heima.user.controller.v1;


import com.heima.common.constant.UserConstants;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.user.dto.AuthDto;
import com.heima.user.service.ApUserRealNameService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 用户分页列表查询
 */
@RestController
@RequestMapping("/api/v1/auth")
@Api("用户列表信息")
public class ApUserRealnameController {


    @Autowired
    ApUserRealNameService apUserRealNameService;

    /**
     * 用户列表信息
     * @param dto
     * @return
     */
    @PostMapping("/list")
    @ApiOperation("用户分页列表查询")
    public ResponseResult list(@RequestBody AuthDto dto){
        return apUserRealNameService.list(dto);
    }

    /**
     * 审核成功
     * @param dto
     * @return
     */
    @PostMapping("/authPass")
    @ApiOperation("审核成功")
    public ResponseResult authPass(@RequestBody AuthDto dto){
        return apUserRealNameService.auth(dto,UserConstants.PASS_AUTH);
    }

    /**
     * 审核失败
     * @param dto
     * @return
     */
    @PostMapping("/authFail")
    @ApiOperation("审核失败")
    public ResponseResult authFail(@RequestBody AuthDto dto){
        return apUserRealNameService.auth(dto,UserConstants.FAIL_AUTH);
    }

}
